#include <func.h>

void *function(void*p)
{
    printf("i am %ld\n",(long)p);
    return NULL;
}

int main()
{
    pthread_t pth[2];
    int ret;
    for(long i=0;i<2;i++)
    {
        ret=pthread_create(&pth[i],NULL,function,(void*)i);
        THREAD_ERR_CHECK(ret,"pthread_create");
    }
    ret=pthread_join(pth[0],NULL);
    THREAD_ERR_CHECK(ret,"pthread_join");
    ret=pthread_join(pth[1],NULL);
    THREAD_ERR_CHECK(ret,"pthread_join");
    printf("I am main thread\n");
    return 0;
}